<?php

class admin_controller_system_log extends admin_controller
{

	public function listing()
	{
		$user_id = get('user_id', 0, 'int');
		$key = get('key', '');
		
		$model_log = $this->get_admin_model();
		$template = $this->get_admin_template();
        $template->set_title('系统日志');

		$limit = 20;
		$pagination = bone::get_ui('pagination');
		$pagination->set_limit( $limit );
		$pagination->set_total($model_log->get_log_sum($user_id, $key));
		$pagination->set_page( get('page', 1, 'int') );
		$pagination->update();

		$template->set('pagination', $pagination);
		$template->set('user_id', $user_id);
		$template->set('key', $key);
		$template->set('admins', $model_log->get_admins() );
		$template->set('logs', $model_log->get_logs($user_id, $key, $pagination->get_offset(), $limit) );
		
		$template->display();
	}
}
?>